package flash.text;

#if flash
import openfl.display.DisplayObject;
import openfl.display.InteractiveObject;
import openfl.geom.Rectangle;

extern class TextField extends InteractiveObject
{
	#if (haxe_ver < 4.3)
	public var alwaysShowSelection:Bool;
	public var antiAliasType:AntiAliasType;
	public var autoSize:TextFieldAutoSize;
	public var background:Bool;
	public var backgroundColor:Int;
	public var border:Bool;
	public var borderColor:Int;
	public var bottomScrollV(default, never):Int;
	public var caretIndex(default, never):Int;
	public var condenseWhite:Bool;
	public var defaultTextFormat:TextFormat;
	public var displayAsPassword:Bool;
	public var embedFonts:Bool;
	public var gridFitType:GridFitType;
	public var htmlText:String;
	public var length(default, never):Int;
	public var maxChars:Int;
	public var maxScrollH(default, never):Int;
	public var maxScrollV(default, never):Int;
	public var mouseWheelEnabled:Bool;
	public var multiline:Bool;
	public var numLines(default, never):Int;
	public var restrict:String;
	public var scrollH:Int;
	public var scrollV:Int;
	public var selectable:Bool;
	public var selectionBeginIndex(default, never):Int;
	public var selectionEndIndex:Int;
	public var sharpness:Float;
	public var styleSheet:StyleSheet;
	public var text:String;
	public var textColor:Int;
	public var textHeight(default, never):Float;
	@:require(flash11) public var textInteractionMode:String;
	public var textWidth(default, never):Float;
	public var thickness:Float;
	public var type:TextFieldType;
	public var useRichTextClipboard:Bool;
	public var wordWrap:Bool;
	#else
	@:flash.property var alwaysShowSelection(get, set):Bool;
	@:flash.property var antiAliasType(get, set):AntiAliasType;
	@:flash.property var autoSize(get, set):TextFieldAutoSize;
	@:flash.property var background(get, set):Bool;
	@:flash.property var backgroundColor(get, set):UInt;
	@:flash.property var border(get, set):Bool;
	@:flash.property var borderColor(get, set):UInt;
	@:flash.property var bottomScrollV(get, never):Int;
	@:flash.property var caretIndex(get, never):Int;
	@:flash.property var condenseWhite(get, set):Bool;
	@:flash.property var defaultTextFormat(get, set):TextFormat;
	@:flash.property var displayAsPassword(get, set):Bool;
	@:flash.property var embedFonts(get, set):Bool;
	@:flash.property var gridFitType(get, set):GridFitType;
	@:flash.property var htmlText(get, set):String;
	@:flash.property var length(get, never):Int;
	@:flash.property var maxChars(get, set):Int;
	@:flash.property var maxScrollH(get, never):Int;
	@:flash.property var maxScrollV(get, never):Int;
	@:flash.property var mouseWheelEnabled(get, set):Bool;
	@:flash.property var multiline(get, set):Bool;
	@:flash.property var numLines(get, never):Int;
	@:flash.property var restrict(get, set):String;
	@:flash.property var scrollH(get, set):Int;
	@:flash.property var scrollV(get, set):Int;
	@:flash.property var selectable(get, set):Bool;
	@:flash.property var selectedText(get, never):String;
	@:flash.property var selectionBeginIndex(get, never):Int;
	@:flash.property var selectionEndIndex(get, never):Int;
	@:flash.property var sharpness(get, set):Float;
	@:flash.property var styleSheet(get, set):StyleSheet;
	@:flash.property var text(get, set):String;
	@:flash.property var textColor(get, set):UInt;
	@:flash.property var textHeight(get, never):Float;
	@:flash.property @:require(flash11) var textInteractionMode(get, never):TextInteractionMode;
	@:flash.property var textWidth(get, never):Float;
	@:flash.property var thickness(get, set):Float;
	@:flash.property var type(get, set):TextFieldType;
	@:flash.property var useRichTextClipboard(get, set):Bool;
	@:flash.property var wordWrap(get, set):Bool;
	#end

	public function new();
	public function appendText(text:String):Void;
	public function getCharBoundaries(charIndex:Int):Rectangle;
	public function getCharIndexAtPoint(x:Float, y:Float):Int;
	public function getFirstCharInParagraph(charIndex:Int):Int;
	public function getImageReference(id:String):DisplayObject;
	public function getLineIndexAtPoint(x:Float, y:Float):Int;
	public function getLineIndexOfChar(charIndex:Int):Int;
	public function getLineLength(lineIndex:Int):Int;
	public function getLineMetrics(lineIndex:Int):TextLineMetrics;
	public function getLineOffset(lineIndex:Int):Int;
	public function getLineText(lineIndex:Int):String;
	public function getParagraphLength(charIndex:Int):Int;
	public function getTextFormat(beginIndex:Int = 0, endIndex:Int = 0):TextFormat;
	@:require(flash10) public static function isFontCompatible(fontName:String, fontStyle:FontStyle):Bool;
	public function replaceSelectedText(value:String):Void;
	public function replaceText(beginIndex:Int, endIndex:Int, newText:String):Void;
	public function setSelection(beginIndex:Int, endIndex:Int):Void;
	public function setTextFormat(format:TextFormat, beginIndex:Int = 0, endIndex:Int = 0):Void;

	#if (haxe_ver >= 4.3)
	private function get_alwaysShowSelection():Bool;
	private function get_antiAliasType():AntiAliasType;
	private function get_autoSize():TextFieldAutoSize;
	private function get_background():Bool;
	private function get_backgroundColor():UInt;
	private function get_border():Bool;
	private function get_borderColor():UInt;
	private function get_bottomScrollV():Int;
	private function get_caretIndex():Int;
	private function get_condenseWhite():Bool;
	private function get_defaultTextFormat():TextFormat;
	private function get_displayAsPassword():Bool;
	private function get_embedFonts():Bool;
	private function get_gridFitType():GridFitType;
	private function get_htmlText():String;
	private function get_length():Int;
	private function get_maxChars():Int;
	private function get_maxScrollH():Int;
	private function get_maxScrollV():Int;
	private function get_mouseWheelEnabled():Bool;
	private function get_multiline():Bool;
	private function get_numLines():Int;
	private function get_restrict():String;
	private function get_scrollH():Int;
	private function get_scrollV():Int;
	private function get_selectable():Bool;
	private function get_selectedText():String;
	private function get_selectionBeginIndex():Int;
	private function get_selectionEndIndex():Int;
	private function get_sharpness():Float;
	private function get_styleSheet():StyleSheet;
	private function get_text():String;
	private function get_textColor():UInt;
	private function get_textHeight():Float;
	private function get_textInteractionMode():TextInteractionMode;
	private function get_textWidth():Float;
	private function get_thickness():Float;
	private function get_type():TextFieldType;
	private function get_useRichTextClipboard():Bool;
	private function get_wordWrap():Bool;
	private function set_alwaysShowSelection(value:Bool):Bool;
	private function set_antiAliasType(value:AntiAliasType):AntiAliasType;
	private function set_autoSize(value:TextFieldAutoSize):TextFieldAutoSize;
	private function set_background(value:Bool):Bool;
	private function set_backgroundColor(value:UInt):UInt;
	private function set_border(value:Bool):Bool;
	private function set_borderColor(value:UInt):UInt;
	private function set_condenseWhite(value:Bool):Bool;
	private function set_defaultTextFormat(value:TextFormat):TextFormat;
	private function set_displayAsPassword(value:Bool):Bool;
	private function set_embedFonts(value:Bool):Bool;
	private function set_gridFitType(value:GridFitType):GridFitType;
	private function set_htmlText(value:String):String;
	private function set_maxChars(value:Int):Int;
	private function set_mouseWheelEnabled(value:Bool):Bool;
	private function set_multiline(value:Bool):Bool;
	private function set_restrict(value:String):String;
	private function set_scrollH(value:Int):Int;
	private function set_scrollV(value:Int):Int;
	private function set_selectable(value:Bool):Bool;
	private function set_sharpness(value:Float):Float;
	private function set_styleSheet(value:StyleSheet):StyleSheet;
	private function set_text(value:String):String;
	private function set_textColor(value:UInt):UInt;
	private function set_thickness(value:Float):Float;
	private function set_type(value:TextFieldType):TextFieldType;
	private function set_useRichTextClipboard(value:Bool):Bool;
	private function set_wordWrap(value:Bool):Bool;
	#end
}
#else
typedef TextField = openfl.text.TextField;
#end
